<template>
  <div class="main-page">
    <el-container class="el-container">
      <el-aside :width="isCollapse ? '60px' : '240px'" class="el-aside">
        <main-menu :is-collapse="isCollapse" />
      </el-aside>
      <el-container>
        <el-header height='50px' class="el-header">
          <main-header @change-fold="changeCollapse" />
        </el-header>
        <el-main class="el-main">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import MainHeader from '@/components/main-header/main-header.vue';
import MainMenu from '@/components/main-menu/main-menu.vue';
import { ref } from 'vue';

const isCollapse = ref(false);

function changeCollapse(isFold: boolean) {
  isCollapse.value = isFold;
}

</script>
<style scoped lang="less">
.main-page {
  height: 100%;

  .el-container {
    height: 100%;

    // 侧边栏 滚动条样式调整
    .el-aside {
      // 隐藏水平滚动条
      overflow-x: hidden;
      // 显示垂直滚动条并允许内容滚动
      overflow-y: auto;
      // 文本左对齐
      text-align: left;
      cursor: pointer;
      background-color: #001529;
      // 宽度变化时有 0.5 秒的线性过渡效果  折叠时候宽度会变化
      transition: width 0.5s ease;
      /*firefox*/
      scrollbar-width: none;
      /*IE1+*/
      -ms-overflow-style: none;

      // Webkit 浏览器（如 Chrome 和 Safari）通过自定义滚动条样式
      &::-webkit-scrollbar {
        display: none;
      }
    }

    .el-header {
      background-color: #B3C0D1;
      color: #333;
    }

    .el-main {
      background-color: #E9EEF3;
      color: #333;
    }
  }
}
</style>
